/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.nc.kyiv.yellow.sociallibrary.similarUse;

import com.nc.kyiv.yellow.sociallibrary.ConnectionManager.ConnectionManager;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import javax.sql.DataSource;

/**
 *
 * @author Alena
 */
public abstract class AbstractDataSet {
    

    public AbstractDataSet() throws Exception{
    }

    public Connection getConnection(DataSource source) {
        try {
            Connection conn = ConnectionManager.getConnection();
            conn.setAutoCommit(false);
            return conn;

        } catch (SQLException ex) {
            return null;
        }
    }
    
    public void releaseConnection(Connection connection){
        try {
            ConnectionManager.releaseConnection(connection);
        } catch (Exception ex) {
        }
    }
    
    public abstract List<?> getDataSet (Map<String, String> params) throws SQLException, Exception; 
    
}
